<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html>
    <head>
        <title>Search</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <h1>Search Page</h1>
        <form action="ProcessServlet" method="POST">
            <table border="0">
                <tr>
                    <td>Name</td>
                    <td><input type="text" name="txtName" value=""><br/></td>
                </tr>
                <tr>
                    <td><input type="submit" value="Search" name="btAction"/></td>
                    <td><input type="button" value="Go Home" onclick="window.location.href='/XMLProject'"/></td>
                </tr>
            </table>
        </form>

       
        <c:if test="${not empty INFOR}">
            <table border="0">
                <thead>
                    <tr>
                        <th>No.</th>
                        <th>Customer Code</th>
                        <th>Customer name</th>
                        <th>Identify Number</th>
                        <th>Phone</th>
                        <th>Email</th>
                        <th>Diem</th>
                    </tr>
                </thead>
                <tbody>
                    <c:forEach var="chokhoa" items="${INFOR}" varStatus="counter">
                    <form action="ProcessServlet">
                        <tr>
                            <td>${counter.count}</td>
                            <td>${chokhoa.customerCode}</td>
                            <td>${chokhoa.customerName}</td>
                            <td>${chokhoa.identifyNumber}</td>
                            <td>${chokhoa.phone}</td>
                            <td>${chokhoa.email}</td>
                            <td>${chokhoa.diemTichLuy}</td>
                            <td>
                                <c:url var="delLink" value="ProcessServlet">
                                    <c:param name="id" value="${chokhoa.customerCode}"></c:param>
                                    <c:param name="btAction" value="Delete"></c:param>
                                    <c:param name="searchQueryString" value="${param.txtName}"></c:param>
                                </c:url>
                                <a href="${delLink}">Delete</a>

                                <c:url var="editLink" value="ProcessServlet">
                                    <c:param name="id" value="${account.CustomerCode}"></c:param>
                                    <c:param name="btAction" value="Edit"></c:param>
                                </c:url>
                                <a href="${editLink}">Edit</a>
                            </td>
                        </tr>
                        </form>
                    </c:forEach>
                </tbody>
            </table>
        </c:if>
    </body>
</html>
